home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-25 | 19.1 KB | 528 lines | [TEXT/CWIE] |
- // ==================================================
- // touchMeReadme.cp
- // Copyright (C) 1994-1997 Mizutori Tetsuya
- // v.1.0 March 9, 1994 written in THINK-C
- // v.1.1 July 4 ,1996 written in CodeWarrior 9
- // v.1.1.1 August 4, 1996 written in CodeWarrior 9
- // v.1.1.2 February 3, 1997 written in CodeWarrior 11
- // v.1.2 April 25, 1997 written in CodeWarrior 11
- // ==================================================
- // All documents are pretty-printed in 10-point Geneva font.
-
- #ifdef COMMENT
-
- // This summary of functions are made with 'HeaderSampler.pl'.
-
- Symbol Table for member functions or variables:
- =s= public: static
- =v= public: virtual
- =.= public:
- >s> protected: static
- >v> protected: virtual
- >.> protected:
- (s) private: static
- (v) private: virtual
- (.) private:
-
-
- // --------------------------------------------------
- // CTouchMe Program Roadmap
- // --------------------------------------------------
-
- // --------------------------------------------------
-
- CTouchMeApp
- * superclass: LDocApplication
- * function:
- =.= CTouchMeApp ()
- =v= ~CTouchMeApp ()
-
- =v= ObeyCommand Boolean(CommandT, void *)
- =v= FindCommandStatus void(CommandT, Boolean &, Boolean &, Char16 &, Str255)
- // Execute once when launched by receiving Finder's OpenApplication event
- >v> StartUp void()
- // Execute every time whenever OpenDocument AppleEvent was received
- // Do touch command, or fill date time stamp field if option-key is pressed
- >v> OpenDocument void(FSSpec *)
- >v> ChooseDocument void()
- // Reset the working status every time when a series of execution has finished
- >v> UseIdleTime void(const EventRecord &)
- // Override the procedure to make a patch for displaying "About..." dialog
- >v> ShowAboutBox void()
- // Application-spicific functions
- >.> MakeMainWindow LWindow *()
- >.> HandleDocuments void()
-
- // My AppleEvent handlers for 'HandleXXX()' functions
- >v> HandleAppleEvent void(const AppleEvent &, AppleEvent &, AEDesc &, Int32)
- // For responding AppleScript commands;
- // 'get prefs', 'set prefs', 'load prefs', 'save prefs', 'touch', 'fetch'
- >.> HandleGetPrefs void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleSetPrefs void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleLoadPrefs void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleSavePrefs void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleTouch void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleFetch void(const AppleEvent, AppleEvent &, AEDesc &)
- >.> HandleGetPrefsSettings void(AERecord &, ETouchType, Boolean)
- >.> HandleSetPrefsSettings void(AERecord &, ETouchType)
- >.> HandleFetchDateTime void(AERecord &, FSSpec &, Boolean)
-
- * variable:
- >s> MyAlertPatch pascal Boolean(DialogRef, EventRecord *, short *)
- (.) LWindow * mMainWindow // Instance object of class 'CTouchMeMainWindow'
- (.) LArray * mFileArray // Instance object of file stack array
- (.) CTouchMePref * mPref // Instance object of class 'CTouchMePref'
- (.) CAppleGuideFile * mAppleGuideFile // Instance object of Apple Guide file
-
- (s) ModalFilterUPP sAlertPatchProc // A patch for displaying colored alert dialog
-
- (.) Boolean mOpenApplication // true if launched by the OpenApplication event
- (.) Boolean mOpenDocument // true if invoked by the OpenDocument event
- (.) Boolean mKeyModifier // Check the modifier key if pressed on "Open..." command
- (.) Boolean mUpdatePref // true if settings must be reset by prefs data
- (.) long mCount // A counter of execution times in the series of document files
- (.) Boolean mIsCommandPeriod // true if cmd-period key is pressed
-
- * resource:
- touchMeAppleEvents.r // Resource definition for AppleEvent 'aedt' and 'aete'
- touchMeVersion.r // Version resource
-
- // --------------------------------------------------
-
- CTouchMeMainWindow
- * superclass: LDialogBox, LBroadcaster, LDragAndDrop
- * function:
- =s= CreateTouchMeMainWindowStream CTouchMeMainWindow *(LStream)
- =.= CTouchMeMainWindow (LStream)
- =.= ~CTouchMeMainWindow ()
-
- =v= FindCommandStatus void(CommandT, Boolean, Boolean, Char16, Str255)
- // Control the synchronous RadioButton changes
- // Control the 'Current Date Time Now!' button, and others
- =v= ListenToMessage void(MessageT, void)
- // Set and Get dialog status according to the 'CTouchMePref' instance data
- // Get the global frame rect, a bound of dialog
- =.= GetGlobalFrameRect void(Rect &)
- // Move the dialog window
- =.= MoveWindow void(Rect &)
- // Setup dialog status according to the 'pref' data
- =.= SetupDialog void(const SPrefsRec &)
- // Set the 'pref' data according to the dialog status
- =.= InspectDialog void(SPrefsRec &)
- // Show an indiactor whether the modifier key is pressed
- =.= Indicator void(const Boolean)
- // for Dialog
- // Add listeners of RadioButtons to broadcaster of LStdCheckBox
- >v> FinishCreateSelf void()
- // Draw my additional figures in the dialog window
- >v> DrawSelf void()
- // Quit program like as "Cancel" button if "Close Box" was selected
- >v> AttemptClose void()
-
- // for Dialog
- (.) SetEditFieldText void(PaneIDT, const Str255, Boolean)
- (.) SetEditFieldTextRefresh void(PaneIDT, const Str255, Boolean)
- (.) GetEditFieldText void(PaneIDT, Str255, Boolean)
- (.) SetEditFieldDateTime void(PaneIDT, const unsigned long, Boolean)
- (.) GetPairedPaneID PaneIDT(const PaneIDT)
-
- // for Dialog
- // Drag&Drop; accept files or folders dropped from Finder
- >v> ItemIsAcceptable Boolean(DragReference, ItemReference)
- // Drag&Drop; retrieve the FSSpec from the dropped object
- // Set the date time stamp fields according to the accepted file
- // Or do touch command if option-key is pressed
- >v> ReceiveDragItem void(DragReference, DragAttributes, ItemReference, Rect)
- // Drag&Drop; execute once if entered into the area
- >v> EnterDropArea void(DragReference, Boolean)
- // Drag&Drop; execute once if left from the area
- >v> LeaveDropArea void(DragReference)
- // Drag&Drop; execute while staying in the area
- >v> InsideDropArea void(DragReference)
- // Drag&Drop; assign my custum hilite region of EditFields
- >v> HiliteDropArea void(DragReference)
- // for Drag and Drop
- (.) IsModifierKeyPressed Boolean(DragReference)
- (.) FindPaneByMouse PaneIDT(const Point)
- (.) HilitePane void(const PaneIDT)
- (.) HiliteRect void(const Rect &)
-
- * variable:
- (.) Boolean mGlobalModifier
-
- // for Drag and Drop
- (.) Boolean mTEActive
- (.) Boolean mModifier
- (.) Boolean mTextDrag
- (.) PaneIDT mHilitePaneID
- (.) PaneIDT mTargetID
- (.) LCommander * mTarget
-
- // --------------------------------------------------
-
- CTouchMePref
- * superclass: CPrefsFile
- * function:
- =.= CTouchMePref ()
- =.= CTouchMePref (ConstStr255Param)
- =v= ~CTouchMePref ()
-
- // Load prefs data from the Preferences file.
- =.= LoadPrefsData OSErr()
- // Save prefs data to the Preferences file.
- =.= SavePrefsData OSErr()
- // Set the window's settings by prefs data.
- =.= SetPrefsToWindow void(LWindow *)
- // Get the window's settings to prefs data.
- =.= GetPrefsFromWindow void(LWindow *)
-
- // Set and Get the settings data of the member 'XXX'
- =.= SetWindowRect void(Rect &)
- =.= GetWindowRect void(Rect &)
- =.= SetSync void(const Boolean)
- =.= GetSync Boolean()
- =.= SetEnabled void(const ETouchType, const Boolean)
- =.= GetEnabled Boolean(const ETouchType)
- =.= SetFlag void(const ETouchType, const ETouchFlag, const Boolean)
- =.= GetFlag Boolean(const ETouchType, const ETouchFlag)
- =.= SetFlagNumb void(const ETouchType, const ETouchFlag)
- =.= GetFlagNumb ETouchFlag(const ETouchType)
- =.= SetDateTime void(const ETouchType, const unsigned long)
- =.= GetDateTime unsigned long(const ETouchType)
- (.) SetupConstants void()
- // Transform preferences data to/from 'mPrefs' record.
- (.) TransformToSettings void()
- (.) TransformFromSettings void()
-
- * variable:
- (.) SPrefsRec mPrefs // A working data structure for handling preferences file
-
- // --------------------------------------------------
- // Common Utilities
- // --------------------------------------------------
-
- CAppleGuideFile
- * superclass:
- * function:
- =.= CAppleGuideFile (OSType)
- =.= CAppleGuideFile (ConstStr255Param)
- =v= ~CAppleGuideFile ()
-
- // Check if Apple Guide is installed or not.
- =s= AppleGuideIsPresent Boolean()
- // Open the specified guide file located in the application's folder.
- =v= Open AGErr()
- // Find a default guide file in the same folder where the application is located.
- // OSErr FindGuideFile( void );
- >.> FindGuideFile OSErr(ConstStr255Param)
- >.> FindGuideFile OSErr(OSType)
-
- * variable:
- (.) Str63 mGuideFilename // A particular Apple Guide file name
- (.) Boolean mGotGuideFile // true if mGuideFile is valid.
- (.) FSSpec mGuideFileFSSpec // A file spec of the guide file.
- (.) OSType mGuideCreatorType // An application creator type.
- (.) AGRefNum mGuideFileRefNum // A reference number of opened guide file.
-
- // --------------------------------------------------
-
- CDateEditField
- * superclass: LEditField, LListener, LBroadcaster
- * function:
- =s= CreateDateEditFieldStream CDateEditField *(LStream)
- =.= CDateEditField ()
- =.= CDateEditField (const CDateEditField)
- =.= CDateEditField (const SPaneInfo, Str255, ResIDT, Int16, Boolean, Boolean, KeyFilterFunc, LCommander)
- =.= CDateEditField (const SPaneInfo, Str255, ResIDT, Int16, Uint8, KeyFilterFunc, LCommander)
- =.= CDateEditField (LStream)
- =v= ~CDateEditField ()
-
- // Do nothing here
- =v= ListenToMessage void(MessageT, void *)
- // Set 'mHasChanged' to true if text has been changed
- =v= UserChangedText void()
- // Do dragging text
- =v= ClickSelf void(const SMouseDownEvent &)
- // Do nothing here
- =v= BeTarget void()
- // Call RefreshEditField() once when this EditField becomes no target
- =v= DontBeTarget void()
- // Handle dragging text in this edit field.
- =.= DoDragText Boolean(const EventRecord, const Point)
-
- // Test / Set the activity status of TextEdit
- =.= GetTEActive Boolean()
- =.= SetTEActive void(const Boolean)
- // Get / Set the selection of TextEdit
- =.= GetSelect void(long &, long &)
- =.= SetSelect void(const long, const long)
- // Read / Write the text string from this EditField
- =.= GetText void(Str255)
- =.= SetText void(const Str255)
- // Write text string, and then refresh it
- =.= SetTextAndRefresh void(const Str255)
- // Convert date time seconds to string, and write it
- =.= SetDateTime void(const unsigned long)
- // Refresh the EditField if this text has been changed
- =.= RefreshEditField void()
-
- * variable:
- (.) Boolean mHasChanged // true if text has been changed by user's action
-
- // --------------------------------------------------
-
- CFlavor
- * superclass: none
- * function:
- =.= CFlavor ()
- =.= CFlavor (DragReference, ItemReference)
- =.= ~CFlavor ()
-
- // Retrieve data from a drag reference
- (.) GetFlavorText OSErr(DragReference, ItemReference, Handle, Size &)
- (.) GetFlavorPString OSErr(DragReference, ItemReference, Str255)
- (.) GetFlavorHFS OSErr(DragReference, ItemReference, HFSFlavor &)
- (.) GetFlavorFSSpec OSErr(DragReference, ItemReference, FSSpec &)
-
- * variable:
- =.= FlavorType mType
- =.= Handle mTextH
- =.= long mTextLen
- =.= FSSpec mFSSpec
-
- // --------------------------------------------------
-
- CPrefsFile
- * superclass: LPreferencesFile
- * function:
- =.= CPrefsFile ()
- =.= CPrefsFile (ConstStr255Param, OSType)
- =v= ~CPrefsFile ()
-
- // Setup constants at startup.
- >.> SetupConstants void()
- >.> SetupFileInfo void(OSType, OSType)
- >.> SetupResType void(ResType, ResIDT)
-
- // Read a block data from the preferences file
- >.> LoadPrefs OSErr(long &, Handle)
- >.> LoadPrefs OSErr(long &, Handle, ResType, ResIDT)
- // Write a block data to the preferences file
- >.> SavePrefs OSErr(long, Handle)
- >.> SavePrefs OSErr(long, Handle, ResType, ResIDT)
-
- * variable:
- (.) OSType mPrefFileType // 'pref'
- (.) OSType mPrefFileCreator // 'MzTm'
- (.) ResType mPrefResType // 'PREF'
- (.) ResIDT mPrefResID // 1000
-
- // --------------------------------------------------
-
- CRadioButton
- * superclass: LStdRadioButton, LListener
- * function:
- =s= CreateRadioButtonStream CRadioButton *(LStream *)
- =.= CRadioButton ()
- =.= CRadioButton (const CRadioButton)
- =.= CRadioButton (const SPaneInfo, MessageT, Int32, ResIDT, Str255)
- =.= CRadioButton (LStream *)
- =v= ~CRadioButton ()
-
- // Listen to CheckBox and change its Enable/Disable status
- =v= ListenToMessage void(MessageT, void *)
-
- // --------------------------------------------------
-
- UAppleEvents
- * superclass: none
- * function:
- =.= UAppleEvents ()
- =.= ~UAppleEvents ()
-
- // Handling descriptor.
- =s= TheLongDateTime void(const AEDesc &, LongDateTime &)
- =s= TheText void(const AEDesc &, Handle &, long &)
- =s= TheFSSpec void(const AEDesc &, FSSpec &)
-
- // Handling Apple Event.
- =s= GetParamLongDateTime Boolean(const AppleEvent &, AEKeyword, LongDateTime &, const unsigned long)
- =s= GetParamLong Boolean(const AppleEvent &, AEKeyword, long &, const long)
- =s= GetParamEnum Boolean(const AppleEvent &, AEKeyword, OSType &, const OSType)
- =s= GetParamBoolean Boolean(const AppleEvent &, AEKeyword, Boolean &, const Boolean)
- =s= GetParamPString Boolean(const AppleEvent &, AEKeyword, Str255, const StringPtr)
- =s= GetParamText Boolean(const AppleEvent &, AEKeyword, Handle, long &)
- =s= PutParamText void(AppleEvent &, AEKeyword, Handle, long)
- =s= PutParamFSSpec void(AppleEvent &, AEKeyword, const FSSpec &)
- =s= AddFSSpec void(AEDescList &, long, const FSSpec &)
- =s= PutParamFullPathname void(AppleEvent &, AEKeyword, ConstStr255Param)
- =s= AddFullPathname void(AEDescList &, long, ConstStr255Param)
-
- * variable:
-
- // --------------------------------------------------
-
- UDateTime
- * superclass: none
- * function:
- // Convert date time data in 32-bit-lengh seconds to string
- =s= SecondsToDateTimeString void(const unsigned long, Str255, Str255)
- // Convert date time data in 32-bit-lengh seconds from string
- =s= DateTimeStringToSeconds void(const Str255, const Str255, unsigned long &)
- (s) SecondsToDateTime void(const unsigned long, LongDateRec &)
- (s) DateTimeToSeconds void(const LongDateRec &, unsigned long &)
- (s) DateTimeToString void(const LongDateRec &, Str255, Str255)
- (s) StringToDateTime void(const Str255, const Str255, LongDateRec &)
-
- * variable:
-
- // --------------------------------------------------
-
- UDragDropSuit
- * superclass: none
- * function:
- =s= DragText Boolean(const EventRecord &, RgnHandle, unsigned char *, long &, Boolean &)
- =s= InDragRegion Boolean(DragReference)
- =s= ZoomBackBounds void(DragReference, ItemReference)
- (s) MyTrackDrag Boolean(DragReference, const EventRecord &, RgnHandle)
- (s) DropLocationIsFinderTrash Boolean(AEDesc &)
-
- * variable:
- =s= RgnHandle sDragRegion
-
- // --------------------------------------------------
-
- UErrorMessage
- * superclass: none
- * function:
- // Notify error message using Alert/Stop dialog
- =s= NofityIfOSErr void(const OSErr, const Boolean)
- =s= NofityIfOSErr void(const OSErr, const Str255, const Boolean)
-
- * variable:
-
- * resource:
- ErrorMessage.r // Resource definition for error messages and alert dialog
-
- // --------------------------------------------------
-
- UFileTools
- * superclass: none
- * function:
- =.= UFileTools ()
- =.= ~UFileTools ()
-
- // Get the creation/modification date time of the given FSSpec
- =s= GetFSSpecDateTime OSErr(FSSpec &, unsigned long &, unsigned long &)
- // Set the creation/modification date time of the given FSSpec
- =s= SetFSSpecDateTime OSErr(FSSpec &, unsigned long, unsigned long)
-
- (s) GetFileDateTime OSErr(FSSpec &, unsigned long &, unsigned long &)
- (s) SetFileDateTime OSErr(FSSpec &, unsigned long, unsigned long)
- (s) GetFolderDateTime OSErr(FSSpec &, unsigned long &, unsigned long &)
- (s) SetFolderDateTime OSErr(FSSpec &, unsigned long, unsigned long)
-
- // Update the finder's folder status
- =s= TouchDir OSErr(short, long)
- // Test the file type of a particular file
- =s= GetFSSpecType EFileType(FSSpec &)
- =s= QueryFile OSErr(FSSpec &, EFileType &, long &)
- // Search a particure directory for the files in it.
- // begins with one.
- =s= SearchDirectory OSErr(long, FSSpec &, FSSpec &, EFileType &)
- // begins with one.
- =s= SearchDirectory OSErr(long, short, long, FSSpec &, EFileType &)
- // Get the full pathname of a particular file.
- =s= GetFullPathname OSErr(const FSSpec &, Str255, Boolean)
- // Get the file spec of the current application process.
- =s= GetCurrentApplicationFile OSErr(FSSpec &)
-
- =s= PStrCopy void(Str255, const Str255)
- =s= PStrCopy void(Str255, const unsigned char *, const long)
- =s= PStrAppend void(Str255, const Str255)
- =s= PStrAppend void(Str255, const unsigned char *, const long)
-
- * variable:
-
- // --------------------------------------------------
-
- UFinderEvents
- * superclass:
- * function:
- =.= UFinderEvents ()
- =.= ~UFinderEvents ()
-
- // Send a 'Open Selection with File' event to the Finder.
- =s= OpenSelection void(const FSSpec &)
- =s= OpenSelection void(ConstStr255Param)
- // Send a 'GetInfo Selection with File' event to the Finder.
- =s= GetInfoSelection void(const FSSpec &)
- =s= GetInfoSelection void(ConstStr255Param)
-
- // Send a 'XXXX Selection for File' event to the Finder.
- >s> SendAEWithSelectionToFinder void(AEEventID, const FSSpec &)
- >s> SendAEWithSelectionToFinder void(AEEventID, ConstStr255Param)
- // Create an inAEEventID event to be sent to Finder.
- >s> CreateAppleEventForFinder void(AppleEvent &, AEEventID)
- // Put the directory info of file or pathname to the event as a direct parameter.
- >s> PutParamContainer void(AppleEvent &, const FSSpec &)
- >s> PutParamContainer void(AppleEvent &, ConstStr255Param)
- // Add a selection of file[s] or pathname[s] as an "items" parameter.
- >s> PutParamItems void(AppleEvent &, const FSSpec &)
- >s> PutParamItems void(AppleEvent &, ConstStr255Param)
-
- * variable:
-
- // --------------------------------------------------
-
- UMacOSTools
- * superclass:
- * function:
- =.= UMacOSTools ()
- =.= ~UMacOSTools ()
-
- // Check keyboard status wheather cmd-period is pressed.
- =s= IsCommandPeriod Boolean()
- // Check keyboard status wheather a modifier key is pressed.
- =s= IsModifierKeyPressed Boolean(Uint32)
- =s= IsModifierKeyPressed Boolean(const EventRecord &, Uint32)
-
- // Convert a four character code to a Pascal string and return a pointer to the string.
- =s= FourCharCodeToPStr StringPtr(FourCharCode, StringPtr)
- // Convert an Pascal string to a four character code.
- =s= PStrToFourCharCode void(ConstStringPtr, FourCharCode &)
-
- // Set a Finder flag.
- =s= SetFinderFlag void(FSSpec &, Uint16, Boolean)
- // Return whether a Finder flag is on or off.
- =s= HasFinderFlag Boolean(FSSpec &, Uint16)
-
- * variable:
-
- // --------------------------------------------------
-
- UStandardFiles
- * superclass:
- * function:
- =.= UStandardFiles ()
- =.= ~UStandardFiles ()
-
- // Prompts the user to select a File or Directory using a modified Standard Get File dialog box.
- =s= StandardGetFileOrDirectory Boolean(FileFilterUPP, short, ConstSFTypeListPtr, StandardFileReply *)
-
- >s> FileFilter_SelectFile pascal Boolean(CInfoPBPtr, void *)
- >s> DialogHook_SelectFile pascal short(short, DialogPtr, void *)
- >s> SetSelectButtonTitle void(ControlHandle, const Rect &, Str63)
-
- * variable:
- >s> Str63 sCurrentName
- >s> Str255 sSavedString
- >s> Boolean sCustomSelection
-
- * resource:
- UStandardFiles.rsrc
-
- // --------------------------------------------------
-
- #endif // COMMENT
-